home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / coolbar / coolba~1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-26  |  20.4 KB  |  565 lines

  1. VERSION 4.00
  2. Begin VB.Form CoolbarForm 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Cool Bar"
  5.    ClientHeight    =   1665
  6.    ClientLeft      =   615
  7.    ClientTop       =   1560
  8.    ClientWidth     =   11040
  9.    Height          =   2070
  10.    Icon            =   "Cool Bar.frx":0000
  11.    Left            =   555
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1665
  17.    ScaleWidth      =   11040
  18.    Top             =   1215
  19.    Width           =   11160
  20.    Begin VB.Frame CoolBarFrame 
  21.       Height          =   1350
  22.       Left            =   120
  23.       TabIndex        =   0
  24.       Top             =   120
  25.       Width           =   10815
  26.       Begin VB.Label CooLBarLabel 
  27.          Alignment       =   2  'Center
  28.          BackStyle       =   0  'Transparent
  29.          Caption         =   "Cool Bar"
  30.          Height          =   255
  31.          Index           =   10
  32.          Left            =   9840
  33.          TabIndex        =   11
  34.          Top             =   840
  35.          Width           =   735
  36.       End
  37.       Begin VB.Image CoolBarImageBw 
  38.          Height          =   480
  39.          Index           =   10
  40.          Left            =   9960
  41.          Picture         =   "Cool Bar.frx":030A
  42.          Top             =   360
  43.          Width           =   480
  44.       End
  45.       Begin VB.Image CoolBarImageColor 
  46.          Height          =   480
  47.          Index           =   10
  48.          Left            =   9960
  49.          Picture         =   "Cool Bar.frx":0614
  50.          Top             =   360
  51.          Visible         =   0   'False
  52.          Width           =   480
  53.       End
  54.       Begin VB.Image CoolBar 
  55.          Height          =   975
  56.          Index           =   10
  57.          Left            =   9720
  58.          Top             =   240
  59.          Width           =   975
  60.       End
  61.       Begin VB.Image CoolBarImageColor 
  62.          Height          =   480
  63.          Index           =   9
  64.          Left            =   9000
  65.          Picture         =   "Cool Bar.frx":091E
  66.          Top             =   360
  67.          Visible         =   0   'False
  68.          Width           =   480
  69.       End
  70.       Begin VB.Image CoolBarImageColor 
  71.          Height          =   480
  72.          Index           =   8
  73.          Left            =   8040
  74.          Picture         =   "Cool Bar.frx":0C28
  75.          Top             =   360
  76.          Visible         =   0   'False
  77.          Width           =   480
  78.       End
  79.       Begin VB.Image CoolBarImageColor 
  80.          Height          =   480
  81.          Index           =   7
  82.          Left            =   7080
  83.          Picture         =   "Cool Bar.frx":0F32
  84.          Top             =   360
  85.          Visible         =   0   'False
  86.          Width           =   480
  87.       End
  88.       Begin VB.Image CoolBarImageColor 
  89.          Height          =   480
  90.          Index           =   6
  91.          Left            =   6120
  92.          Picture         =   "Cool Bar.frx":123C
  93.          Top             =   360
  94.          Visible         =   0   'False
  95.          Width           =   480
  96.       End
  97.       Begin VB.Image CoolBarImageColor 
  98.          Height          =   480
  99.          Index           =   5
  100.          Left            =   5160
  101.          Picture         =   "Cool Bar.frx":1546
  102.          Top             =   360
  103.          Visible         =   0   'False
  104.          Width           =   480
  105.       End
  106.       Begin VB.Image CoolBarImageColor 
  107.          Height          =   480
  108.          Index           =   4
  109.          Left            =   4200
  110.          Picture         =   "Cool Bar.frx":1850
  111.          Top             =   360
  112.          Visible         =   0   'False
  113.          Width           =   480
  114.       End
  115.       Begin VB.Image CoolBarImageColor 
  116.          Height          =   480
  117.          Index           =   3
  118.          Left            =   3240
  119.          Picture         =   "Cool Bar.frx":1B5A
  120.          Top             =   360
  121.          Visible         =   0   'False
  122.          Width           =   480
  123.       End
  124.       Begin VB.Image CoolBarImageColor 
  125.          Height          =   480
  126.          Index           =   2
  127.          Left            =   2280
  128.          Picture         =   "Cool Bar.frx":1E64
  129.          Top             =   360
  130.          Visible         =   0   'False
  131.          Width           =   480
  132.       End
  133.       Begin VB.Image CoolBarImageColor 
  134.          Height          =   480
  135.          Index           =   1
  136.          Left            =   1320
  137.          Picture         =   "Cool Bar.frx":216E
  138.          Top             =   360
  139.          Visible         =   0   'False
  140.          Width           =   480
  141.       End
  142.       Begin VB.Image CoolBarImageColor 
  143.          Height          =   480
  144.          Index           =   0
  145.          Left            =   360
  146.          Picture         =   "Cool Bar.frx":2478
  147.          Top             =   360
  148.          Visible         =   0   'False
  149.          Width           =   480
  150.       End
  151.       Begin VB.Label CooLBarLabel 
  152.          Alignment       =   2  'Center
  153.          BackStyle       =   0  'Transparent
  154.          Caption         =   "Mail"
  155.          Height          =   255
  156.          Index           =   9
  157.          Left            =   8880
  158.          TabIndex        =   10
  159.          Top             =   840
  160.          Width           =   735
  161.       End
  162.       Begin VB.Label CooLBarLabel 
  163.          Alignment       =   2  'Center
  164.          BackStyle       =   0  'Transparent
  165.          Caption         =   "Font"
  166.          Height          =   255
  167.          Index           =   8
  168.          Left            =   7920
  169.          TabIndex        =   9
  170.          Top             =   840
  171.          Width           =   735
  172.       End
  173.       Begin VB.Label CooLBarLabel 
  174.          Alignment       =   2  'Center
  175.          BackStyle       =   0  'Transparent
  176.          Caption         =   "Print"
  177.          Height          =   255
  178.          Index           =   7
  179.          Left            =   6960
  180.          TabIndex        =   8
  181.          Top             =   840
  182.          Width           =   735
  183.       End
  184.       Begin VB.Label CooLBarLabel 
  185.          Alignment       =   2  'Center
  186.          BackStyle       =   0  'Transparent
  187.          Caption         =   "Favorites"
  188.          Height          =   255
  189.          Index           =   6
  190.          Left            =   6000
  191.          TabIndex        =   7
  192.          Top             =   840
  193.          Width           =   735
  194.       End
  195.       Begin VB.Label CooLBarLabel 
  196.          Alignment       =   2  'Center
  197.          BackStyle       =   0  'Transparent
  198.          Caption         =   "Search"
  199.          Height          =   255
  200.          Index           =   5
  201.          Left            =   5040
  202.          TabIndex        =   6
  203.          Top             =   840
  204.          Width           =   735
  205.       End
  206.       Begin VB.Label CooLBarLabel 
  207.          Alignment       =   2  'Center
  208.          BackStyle       =   0  'Transparent
  209.          Caption         =   "Home"
  210.          Height          =   255
  211.          Index           =   4
  212.          Left            =   4080
  213.          TabIndex        =   5
  214.          Top             =   840
  215.          Width           =   735
  216.       End
  217.       Begin VB.Label CooLBarLabel 
  218.          Alignment       =   2  'Center
  219.          BackStyle       =   0  'Transparent
  220.          Caption         =   "Refresh"
  221.          Height          =   255
  222.          Index           =   3
  223.          Left            =   3120
  224.          TabIndex        =   4
  225.          Top             =   840
  226.          Width           =   735
  227.       End
  228.       Begin VB.Label CooLBarLabel 
  229.          Alignment       =   2  'Center
  230.          BackStyle       =   0  'Transparent
  231.          Caption         =   "Stop"
  232.          Height          =   255
  233.          Index           =   2
  234.          Left            =   2160
  235.          TabIndex        =   3
  236.          Top             =   840
  237.          Width           =   735
  238.       End
  239.       Begin VB.Label CooLBarLabel 
  240.          Alignment       =   2  'Center
  241.          BackStyle       =   0  'Transparent
  242.          Caption         =   "Forward"
  243.          Height          =   255
  244.          Index           =   1
  245.          Left            =   1200
  246.          TabIndex        =   2
  247.          Top             =   840
  248.          Width           =   735
  249.       End
  250.       Begin VB.Label CooLBarLabel 
  251.          Alignment       =   2  'Center
  252.          BackStyle       =   0  'Transparent
  253.          Caption         =   "Back"
  254.          Height          =   255
  255.          Index           =   0
  256.          Left            =   240
  257.          TabIndex        =   1
  258.          Top             =   840
  259.          Width           =   735
  260.       End
  261.       Begin VB.Image CoolBarImageBw 
  262.          Height          =   480
  263.          Index           =   9
  264.          Left            =   9000
  265.          Picture         =   "Cool Bar.frx":2782
  266.          Top             =   360
  267.          Width           =   480
  268.       End
  269.       Begin VB.Image CoolBarImageBw 
  270.          Height          =   480
  271.          Index           =   8
  272.          Left            =   8040
  273.          Picture         =   "Cool Bar.frx":2A8C
  274.          Top             =   360
  275.          Width           =   480
  276.       End
  277.       Begin VB.Image CoolBarImageBw 
  278.          Height          =   480
  279.          Index           =   7
  280.          Left            =   7080
  281.          Picture         =   "Cool Bar.frx":2D96
  282.          Top             =   360
  283.          Width           =   480
  284.       End
  285.       Begin VB.Image CoolBarImageBw 
  286.          Height          =   480
  287.          Index           =   6
  288.          Left            =   6120
  289.          Picture         =   "Cool Bar.frx":30A0
  290.          Top             =   360
  291.          Width           =   480
  292.       End
  293.       Begin VB.Image CoolBarImageBw 
  294.          Height          =   480
  295.          Index           =   5
  296.          Left            =   5160
  297.          Picture         =   "Cool Bar.frx":33AA
  298.          Top             =   360
  299.          Width           =   480
  300.       End
  301.       Begin VB.Image CoolBarImageBw 
  302.          Height          =   480
  303.          Index           =   4
  304.          Left            =   4200
  305.          Picture         =   "Cool Bar.frx":36B4
  306.          Top             =   360
  307.          Width           =   480
  308.       End
  309.       Begin VB.Image CoolBarImageBw 
  310.          Height          =   480
  311.          Index           =   3
  312.          Left            =   3240
  313.          Picture         =   "Cool Bar.frx":39BE
  314.          Top             =   360
  315.          Width           =   480
  316.       End
  317.       Begin VB.Image CoolBarImageBw 
  318.          Height          =   480
  319.          Index           =   2
  320.          Left            =   2280
  321.          Picture         =   "Cool Bar.frx":3CC8
  322.          Top             =   360
  323.          Width           =   480
  324.       End
  325.       Begin VB.Image CoolBarImageBw 
  326.          Height          =   480
  327.          Index           =   1
  328.          Left            =   1320
  329.          Picture         =   "Cool Bar.frx":3FD2
  330.          Top             =   360
  331.          Width           =   480
  332.       End
  333.       Begin VB.Image CoolBarImageBw 
  334.          Height          =   480
  335.          Index           =   0
  336.          Left            =   360
  337.          Picture         =   "Cool Bar.frx":42DC
  338.          Top             =   360
  339.          Width           =   480
  340.       End
  341.       Begin VB.Image CoolBar 
  342.          Height          =   975
  343.          Index           =   9
  344.          Left            =   8760
  345.          Top             =   240
  346.          Width           =   975
  347.       End
  348.       Begin VB.Image CoolBar 
  349.          Height          =   975
  350.          Index           =   8
  351.          Left            =   7800
  352.          Top             =   240
  353.          Width           =   975
  354.       End
  355.       Begin VB.Image CoolBar 
  356.          Height          =   975
  357.          Index           =   7
  358.          Left            =   6840
  359.          Top             =   240
  360.          Width           =   975
  361.       End
  362.       Begin VB.Image CoolBar 
  363.          Height          =   975
  364.          Index           =   6
  365.          Left            =   5880
  366.          Top             =   240
  367.          Width           =   975
  368.       End
  369.       Begin VB.Image CoolBar 
  370.          Height          =   975
  371.          Index           =   5
  372.          Left            =   4920
  373.          Top             =   240
  374.          Width           =   975
  375.       End
  376.       Begin VB.Image CoolBar 
  377.          Height          =   975
  378.          Index           =   4
  379.          Left            =   3960
  380.          Top             =   240
  381.          Width           =   975
  382.       End
  383.       Begin VB.Image CoolBar 
  384.          Height          =   975
  385.          Index           =   3
  386.          Left            =   3000
  387.          Top             =   240
  388.          Width           =   975
  389.       End
  390.       Begin VB.Image CoolBar 
  391.          Height          =   975
  392.          Index           =   2
  393.          Left            =   2040
  394.          Top             =   240
  395.          Width           =   975
  396.       End
  397.       Begin VB.Image CoolBar 
  398.          Height          =   975
  399.          Index           =   1
  400.          Left            =   1080
  401.          Top             =   240
  402.          Width           =   975
  403.       End
  404.       Begin VB.Image CoolBar 
  405.          Height          =   975
  406.          Index           =   0
  407.          Left            =   120
  408.          Top             =   240
  409.          Width           =   975
  410.       End
  411.       Begin VB.Image ImgBackground 
  412.          Height          =   1200
  413.          Left            =   60
  414.          Picture         =   "Cool Bar.frx":45E6
  415.          Top             =   120
  416.          Width           =   10710
  417.       End
  418.    End
  419. Attribute VB_Name = "CoolbarForm"
  420. Attribute VB_Creatable = False
  421. Attribute VB_Exposed = False
  422. Private PrevButton
  423. Sub ButtonDown(Index)
  424. '* Make sure coolbar button doesn't resize again if user is repeatedly & quickly clicking
  425. If CoolBar(Index).Height <> 975 Or CoolBar(Index).Width <> 975 Then
  426. Exit Sub
  427. End If
  428. '* Shrink & move coolbar button to give impression of a button being pushed
  429. CoolBarImageColor(Index).Left = CoolBarImageColor(Index).Left + 10
  430. CoolBarImageColor(Index).Top = CoolBarImageColor(Index).Top + 10
  431. CooLBarLabel(Index).Left = CooLBarLabel(Index).Left + 10
  432. CooLBarLabel(Index).Top = CooLBarLabel(Index).Top + 10
  433. CoolBar(Index).Left = CoolBar(Index).Left + 10
  434. CoolBar(Index).Top = CoolBar(Index).Top + 10
  435. CoolBar(Index).Height = CoolBar(Index).Height - 40
  436. CoolBar(Index).Width = CoolBar(Index).Width - 40
  437. End Sub
  438. Sub ButtonUp(Index)
  439. '* Make sure coolbar button doesn't resize again if user is repeatedly & quickly clicking
  440. If CoolBar(Index).Height <> 935 Or CoolBar(Index).Width <> 935 Then
  441. Exit Sub
  442. End If
  443. '* Expand & move coolbar button to give impression of a button being lifted
  444. CoolBarImageColor(Index).Left = CoolBarImageColor(Index).Left - 10
  445. CoolBarImageColor(Index).Top = CoolBarImageColor(Index).Top - 10
  446. CooLBarLabel(Index).Left = CooLBarLabel(Index).Left - 10
  447. CooLBarLabel(Index).Top = CooLBarLabel(Index).Top - 10
  448. CoolBar(Index).Left = CoolBar(Index).Left - 10
  449. CoolBar(Index).Top = CoolBar(Index).Top - 10
  450. CoolBar(Index).Height = CoolBar(Index).Height + 40
  451. CoolBar(Index).Width = CoolBar(Index).Width + 40
  452. End Sub
  453. Sub MoveMouse(Index)
  454. '* If the mouse is no longer over the same button then make the previous buttons
  455. '* grayscale icon visible and the color icon invisible and turn it's border off
  456. If Index <> PrevButton Then
  457.     On Error Resume Next
  458.         CoolBar(PrevButton).BorderStyle = 0
  459.         CoolBarImageBw(PrevButton).Visible = True
  460.         CoolBarImageColor(PrevButton).Visible = False
  461. End If
  462. '* If mouse has moved to another button, update Prevbutton so that if mouse is
  463. '* moved again program will know which button to change
  464.     PrevButton = Index
  465. '* If the mouse is on this button turn on the border for this button (image)
  466.     CoolBar(Index).BorderStyle = 1
  467. '* If mouse is on this button then make the grayscale icon invisible and make
  468. '* the color icon visible
  469.     CoolBarImageBw(Index).Visible = False
  470.     CoolBarImageColor(Index).Visible = True
  471. End Sub
  472. Private Sub CoolBar_Click(Index As Integer)
  473. ' Do something here, placing function in title bar as example
  474. CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption
  475. End Sub
  476. Private Sub CoolBar_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  477. '* User pressed a mouse button
  478. ButtonDown (Index)
  479. End Sub
  480. Private Sub CoolBar_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  481. '* User moved the mouse pointer
  482. MoveMouse (Index)
  483. End Sub
  484. Private Sub CoolBar_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  485. '* User released the mouse button
  486. ButtonUp (Index)
  487. End Sub
  488. Private Sub CoolBarImageBw_Click(Index As Integer)
  489. ' Do something here, placing function in title bar as example
  490. CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption
  491. End Sub
  492. Private Sub CoolBarImageBw_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  493. '* User pressed a mouse button
  494. ButtonDown (Index)
  495. End Sub
  496. Private Sub CoolBarImageBw_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  497. '* User moved the mouse pointer
  498. MoveMouse (Index)
  499. End Sub
  500. Private Sub CoolBarImageBw_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  501. '* User released the mouse button
  502. ButtonUp (Index)
  503. End Sub
  504. Private Sub CoolBarImageColor_Click(Index As Integer)
  505. ' Do something here, placing function in title bar as example
  506. CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption
  507. End Sub
  508. Private Sub CoolBarImageColor_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  509. '* User pressed a mouse button
  510. ButtonDown (Index)
  511. End Sub
  512. Private Sub CoolBarImageColor_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  513. '* User moved the mouse pointer
  514. MoveMouse (Index)
  515. End Sub
  516. Private Sub CoolBarImageColor_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  517. '* User released the mouse button
  518. ButtonUp (Index)
  519. End Sub
  520. Private Sub CooLBarLabel_Click(Index As Integer)
  521. ' Do something here, placing function in title bar as example
  522. CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption
  523. End Sub
  524. Private Sub CooLBarLabel_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  525. '* User pressed a mouse button
  526. ButtonDown (Index)
  527. End Sub
  528. Private Sub CooLBarLabel_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  529. '* User moved the mouse pointer
  530. MoveMouse (Index)
  531. End Sub
  532. Private Sub CooLBarLabel_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  533. '* User released the mouse button
  534. ButtonUp (Index)
  535. End Sub
  536. Private Sub Form_Load()
  537. '**********************************************************
  538. '* SUBJECT:     Coolbar                                   *
  539. '* AUTHOR:      Mike Raymer                               *
  540. '* DESCRIPTION: An example of how to creat a coolbar such *
  541. '*              as the one in Internet Explorer without   *
  542. '*              using a 3rd party control                 *
  543. '**********************************************************
  544.     CoolbarForm.Top = (Screen.Height - CoolbarForm.Height) \ 2
  545.     CoolbarForm.Left = (Screen.Width - CoolbarForm.Width) \ 2
  546. End Sub
  547. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  548. '* If the mouse is on the form and not on a button, then turn off the border on the previous
  549. '* button and make the grayscale icon visible and the color icon invisible
  550.     On Error Resume Next
  551.     CoolBar(PrevButton).BorderStyle = 0
  552.     CoolBarImageBw(PrevButton).Visible = True
  553.     CoolBarImageColor(PrevButton).Visible = False
  554.     PrevButton = -1
  555. End Sub
  556. Private Sub ImgBackground_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  557. '* If the mouse is on the background and not on a button, then turn off the border on the previous
  558. '* button and make the grayscale icon visible and the color icon invisible
  559.     On Error Resume Next
  560.     CoolBar(PrevButton).BorderStyle = 0
  561.     CoolBarImageBw(PrevButton).Visible = True
  562.     CoolBarImageColor(PrevButton).Visible = False
  563.     PrevButton = -1
  564. End Sub
  565.